//
//  THEarnAutoManualVC.m
//  YJB
//
//  Created by 中电大维 on 2017/1/11.
//  Copyright © 2017年 YJB. All rights reserved.
//

#import "THEarnAutoManualVC.h"
#import "THEarnMoneyVC.h"
#import "THFlowEarnHomeVC.h"

@interface THEarnAutoManualVC ()
{
    NSArray *_titles;
}
@end

@implementation THEarnAutoManualVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"流量赚钱";
    self.tableView.tableFooterView = [UIView new];
    self.tableView.rowHeight = 50;
    self.tableView.separatorStyle = UITableViewCellSelectionStyleNone;
    self.tableView.backgroundColor = kUIColorFromRGB(0xeeeeee);
    _titles = @[@"自动赚钱",@"手动赚钱"];
}


#pragma mark ----------------------- 表格代理方法
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return _titles.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *ID = @"eranMoneyCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if(cell == nil)
    {
        cell = [[UITableViewCell alloc] init];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        cell.textLabel.font = [UIFont systemFontOfSize:18];
        cell.textLabel.textColor = kUIColorFromRGB(0x333333);
    }
    cell.textLabel.text = _titles[indexPath.section];
    
    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    switch (indexPath.section) {
        case 0:
        {
            THEarnMoneyVC *vc = [[THEarnMoneyVC alloc] init];
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
            
        default://手动赚钱
        {
            [self.navigationController pushViewController:[THFlowEarnHomeVC new] animated:YES];
        }
            break;
    }
    if (indexPath.section) {
        
    }
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *view = [[UIView alloc]init];
    view.backgroundColor = kUIColorFromRGB(0xeeeeee);
    return view;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
//    if (0 == section) {
//        return 30;
//    }
    return 20;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
